<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form th:action="@{/book}" method="post">
    图书名称:<input type="text" name="name" th:text="${name}">
    <br>
    图书类别:<input type="text" name="author" th:text="${author}">
    <br>
    图书作者:<input type="text" name="category" th:text="${category}">
    <br>
    <input type="submit" value="搜索">
</form>
<table border="1px" align="center">
    <tr>
        <td>选择</td>
        <td>编号</td>
        <td>书名</td>
        <td>价格</td>
        <td>类目</td>
        <td>库存</td>
        <td>图片</td>
        <td>说明</td>
        <td>作者</td>
        <td>已售</td>
    </tr>
    <tr th:each="book:${page.books}">
        <td>
            <input type="checkbox" th:value="${book.id}" name="ids">
        </td>
        <td th:text="${book.id}"></td>
        <td th:text="${book.name}"></td>
        <td th:text="${book.price}"></td>
        <td th:text="${book.category}"></td>
        <td th:text="${book.pnum}"></td>
        <td th:text="${book.imgurl}"></td>
        <td th:text="${book.description}"></td>
        <td th:text="${book.author}"></td>
        <td th:text="${book.sales}"></td>
    </tr>
</table>

<div align="center">
    总页数共有：<span th:text="${page.pages}"></span>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    当前页：<span th:text="${page.pageNum}"></span>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    总条数为：<span th:text="${page.total}"></span>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    当前页总条数：<span th:text="${page.pageSize}"></span>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span th:if="${page.hasPreviousPage}">
    <a th:href="@{/book/page(pageNum=${page.pageNum-1})}">上一页</a>
    </span>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span th:each="p:${#numbers.sequence(1,page.pages)}">
    <a th:href="@{/book/page(pageNum=${p})}" th:text="${p}"></a>
    </span>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span th:if="${page.hasNextPage}">
    <a th:href="@{/book/page(pageNum=${page.pageNum+1})}">下一页</a>
    </span>
</div>
</body>
</html>